<?php

namespace app\api\controller\question;

use app\common\controller\Api;
use think\Config;

/**
 * 海量题库
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];


    public function _initialize()
    {
        parent::_initialize();

        if (!Config::get('fastadmin.usercenter')) {
            $this->error(__('User center already closed'));
        }

        $this->category=model('admin/mechanism/Category');

    }
    /**
     * 题库分类
     * @param int $pid
     */
    public function category($pid=0){
        $where['pid']=['=',$pid];
        $where['status']=['=','normal'];
        $this->success('OK',$this->category->where($where)->order('weigh desc')->select());
    }
}
